package app.view.component.movie 
{
	import app.facade.App;
	import com.greensock.TweenLite;
	import com.temple.core.CoreMovieClip;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	/**
	 * ...
	 * @author PHANCUONG87
	 */
	[Embed(source="../../../../../lib/ui.swf", symbol="mcStart")]
	public class McStart extends CoreMovieClip
	{
		public var mcPlayer:MovieClip;
		public function McStart() {
			this.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventHuman);
			this.addEventListener(MouseEvent.MOUSE_UP, onhanlerEvent);
			this.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventHuman);
		}
		
		public function onMouseEventHuman(evt:MouseEvent):void {
			switch (evt.type) 
			{ 
				case MouseEvent.MOUSE_OUT:
					TweenLite.to(this, 0.2, {glowFilter:{color:0x00FF00, blurX:10, blurY:10, strength:5, alpha:0}});
				break;
				case MouseEvent.MOUSE_OVER:
					TweenLite.to(this, 0.2, {glowFilter:{color:0x00FF00, blurX:10, blurY:10, strength:5, alpha:1}});
				break;
				default:
			}
		}
		
		private function onhanlerEvent(evt:MouseEvent):void {
			sendNotification(App.START_GAME);
			mcPlayer.visible = false;
			
			var pos:Point = new Point(this.x,this.y);
			TweenLite.to(this, 15, { scaleX:0.1, scaleY:0.1, y:pos.y - 160, x:pos.x + 90, onComplete: hide } );
			TweenLite.to(this, 0.2, {glowFilter:{color:0x00FF00, blurX:10, blurY:10, strength:5, alpha:0}});
		}
		
		public function hide():void 
		{
			this.visible = false;
		}
		
	}

}